package com.cjh.db2doc;

import com.cjh.db2doc.table.TableInfo;
import com.cjh.db2doc.template.FreemarkerEngine;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

/**
 * com.cjh.db2doc 2022/7/26 11:03
 *
 * @author chenjh
 */
public class DbExportEngine {

    private GeneratorConfig generatorConfig;

    public void generator() throws Exception {
        if (generatorConfig.getDataSourceConfig() == null) {
            throw new RuntimeException("数据库配置为空");
        }
        List<TableInfo> tableList = TableMetadata.getTableList(generatorConfig);
        System.out.println(tableList);
        FreemarkerEngine.generateWord(tableList);
    }

    public GeneratorConfig getGeneratorConfig() {
        return generatorConfig;
    }

    public void setGeneratorConfig(GeneratorConfig generatorConfig) {
        this.generatorConfig = generatorConfig;
    }
}
